<?

class LiveComment extends Portlet {

    const SERVICE = 'service';
    const SUGGEST = 'suggest';

    public $type;

    protected function renderContent() {

        $criteria = new CDbCriteria();
        $criteria->order = "t_lastcomment DESC";
        $criteria->limit = 10;

        if($this->type == self::SERVICE) {
            $data = Service::model()->findAll($criteria);
        } elseif($this->type == self::SUGGEST) {
            $data = Suggest::model()->findAll($criteria);
        } else {
           return false;
        }

        $this->render("liveComment", compact('data'));
    }
}
